Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unit test for host scanner added #87

Merged
merged 11 commits into from
Mar 4, 2023
Merged

Unit test for host scanner added #87

merged 11 commits into from
Mar 4, 2023

Conversation

git-elliot
Copy link
Collaborator

@git-elliot git-elliot commented Mar 3, 2023

Added for all methods of Host Scanner.
Completed mostly all cases for getMaxHost
At least one case of getAllPingableDevices and scanDevicesForSinglePort

@git-elliot git-elliot requested a review from guyluz11 March 3, 2023 19:27
@git-elliot git-elliot linked an issue Mar 3, 2023 that may be closed by this pull request
3 tasks
.thenAnswer((_) => Stream.value(activeHost));
expect(
mockHostScanner.getAllPingableDevices("10.0.0"),
emits(ActiveHost(internetAddress: InternetAddress("10.0.0.1"))),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it pass in GitHub action even though it could be different IP?

Copy link
Collaborator Author

@git-elliot git-elliot Mar 4, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fetching interface address and pinging own machine. Check now @guyluz11

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll add more cases in this PR only later.

@git-elliot git-elliot linked an issue Mar 4, 2023 that may be closed by this pull request
@git-elliot git-elliot removed a link to an issue Mar 4, 2023
3 tasks
@git-elliot git-elliot changed the title Unit test for host scanner added using mockito Unit test for host scanner added Mar 4, 2023
emits(isA<ActiveHost>()),
);
});

test('Running getMaxHost tests', () {
expect(HostScanner.getMaxHost("10.0.0.0"), HostScanner.classASubnets);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't it supposed to be 127.0.0.254 ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this function uses first octet of IPV4 to check for Subnet class. Success cases are added as of now. Will add more case where it cover cases like "10.0.0.0" can't be classB address.

@git-elliot git-elliot merged commit 0c00513 into dev Mar 4, 2023
@git-elliot git-elliot deleted the hostscanner-unit-test branch March 4, 2023 15:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Create unit tests for HostScanner
2 participants