From 90b05a184b7762592e9cb05d41d9c901b2e7e9b4 Mon Sep 17 00:00:00 2001
From: VakarisZ <vakarisz@yahoo.com>
Date: Mon, 22 Jun 2020 15:17:01 +0300
Subject: [PATCH] Small improvements: aws test removed and path parsing changed
 to use path library in environment_config.py

---
 .../cc/environment/environment_config.py      |  2 +-
 .../monkey_island/cc/environment/test_aws.py  | 26 -------------------
 .../cc/environment/test_environment_config.py |  2 +-
 3 files changed, 2 insertions(+), 28 deletions(-)
 delete mode 100644 monkey/monkey_island/cc/environment/test_aws.py

diff --git a/monkey/monkey_island/cc/environment/environment_config.py b/monkey/monkey_island/cc/environment/environment_config.py
index 4a50fb7cc..9559cdd37 100644
--- a/monkey/monkey_island/cc/environment/environment_config.py
+++ b/monkey/monkey_island/cc/environment/environment_config.py
@@ -49,7 +49,7 @@ class EnvironmentConfig:
 
     @staticmethod
     def get_config_file_path() -> str:
-        return os.path.join(MONKEY_ISLAND_ABS_PATH, 'cc/server_config.json')
+        return os.path.join(MONKEY_ISLAND_ABS_PATH, 'cc', 'server_config.json')
 
     def to_dict(self) -> Dict:
         config_dict = {'server_config': self.server_config,
diff --git a/monkey/monkey_island/cc/environment/test_aws.py b/monkey/monkey_island/cc/environment/test_aws.py
deleted file mode 100644
index 7c5bc26d2..000000000
--- a/monkey/monkey_island/cc/environment/test_aws.py
+++ /dev/null
@@ -1,26 +0,0 @@
-from monkey_island.cc.environment import EnvironmentConfig, UserCreds
-from monkey_island.cc.resources.auth.auth_user import User
-from monkey_island.cc.testing.IslandTestCase import IslandTestCase
-from monkey_island.cc.environment.aws import AwsEnvironment
-
-import hashlib
-
-
-class TestAwsEnvironment(IslandTestCase):
-    def test_get_auth_users(self):
-        env = AwsEnvironment(EnvironmentConfig("", "", UserCreds()))
-        # This is "injecting" the instance id to the env. This is the UTs aren't always executed on the same AWS machine
-        # (might not be an AWS machine at all).
-        # Perhaps it would have been more elegant to create a Mock, but not worth it for
-        # this small test.
-        env._instance_id = "i-666"
-        hash_obj = hashlib.sha3_512()
-        hash_obj.update(b"i-666")
-        auth_users = env.get_auth_users()
-        assert isinstance(auth_users, list)
-        assert len(auth_users) == 1
-        auth_user = auth_users[0]
-        assert isinstance(auth_user, User)
-        assert auth_user.id == 1
-        assert auth_user.username == "monkey"
-        assert auth_user.secret == hash_obj.hexdigest()
diff --git a/monkey/monkey_island/cc/environment/test_environment_config.py b/monkey/monkey_island/cc/environment/test_environment_config.py
index 2a4dbb2bb..c49444ce4 100644
--- a/monkey/monkey_island/cc/environment/test_environment_config.py
+++ b/monkey/monkey_island/cc/environment/test_environment_config.py
@@ -57,7 +57,7 @@ class TestEnvironmentConfig(TestCase):
 
     def test_get_server_config_file_path(self):
         if platform.system() == "Windows":
-            server_file_path = MONKEY_ISLAND_ABS_PATH + "\cc/server_config.json"
+            server_file_path = MONKEY_ISLAND_ABS_PATH + "\cc\server_config.json"
         else:
             server_file_path = MONKEY_ISLAND_ABS_PATH + "/cc/server_config.json"
         self.assertEqual(EnvironmentConfig.get_config_file_path(), server_file_path)