Exemple #1
0
    def test_user_gesture_not_exist_fail(self):
        # Lock
        logger.info("[TESTING] test_user_gesture_not_exist_fail...")
        args = parseArgs([
            "-m", "-a", "create", "-p", "testuser", "-f",
            f"{TEST_IMAGE_DIR}/test_face.jpg", "-l",
            f"{TEST_IMAGE_DIR}/test_lock_1.jpg",
            f"{TEST_IMAGE_DIR}/test_lock_2.jpg",
            f"{TEST_IMAGE_DIR}/test_lock_3.jpg",
            f"{TEST_IMAGE_DIR}/foobar.jpg", "-u",
            f"{TEST_IMAGE_DIR}/test_unlock_1.jpg",
            f"{TEST_IMAGE_DIR}/test_unlock_2.jpg",
            f"{TEST_IMAGE_DIR}/test_unlock_3.jpg",
            f"{TEST_IMAGE_DIR}/test_unlock_4.jpg"
        ])
        with pytest.raises(SystemExit):
            main(args)
        assert readResponseFile()['CODE'] == 17

        # Unlock
        args = parseArgs([
            "-m", "-a", "create", "-p", "testuser", "-f",
            f"{TEST_IMAGE_DIR}/test_face.jpg", "-l",
            f"{TEST_IMAGE_DIR}/test_lock_1.jpg",
            f"{TEST_IMAGE_DIR}/test_lock_2.jpg",
            f"{TEST_IMAGE_DIR}/test_lock_3.jpg",
            f"{TEST_IMAGE_DIR}/test_lock_4.jpg", "-u",
            f"{TEST_IMAGE_DIR}/test_unlock_1.jpg",
            f"{TEST_IMAGE_DIR}/test_unlock_2.jpg",
            f"{TEST_IMAGE_DIR}/test_unlock_3.jpg",
            f"{TEST_IMAGE_DIR}/foobar.jpg"
        ])
        with pytest.raises(SystemExit):
            main(args)
        assert readResponseFile()['CODE'] == 17
Exemple #2
0
 def test_user_edit_no_username_fail(self):
     logger.info("[TESTING] test_user_edit_no_username_fail...")
     args = parseArgs(
         ["-m", "-a", "edit", "-f", f"{TEST_IMAGE_DIR}/foobar.jpg"])
     with pytest.raises(SystemExit):
         main(args)
     assert readResponseFile()['CODE'] == 13
Exemple #3
0
 def test_user_edit_face_not_image_fail(self):
     logger.info("[TESTING] test_user_edit_face_not_image_fail...")
     args = parseArgs([
         "-m", "-a", "edit", "-p", "testuser", "-f",
         f"{TEST_IMAGE_DIR}/placeholder.txt"
     ])
     with pytest.raises(SystemExit):
         main(args)
     assert readResponseFile()['CODE'] == 7
Exemple #4
0
 def test_user_edit_face_success(self):
     logger.info("[TESTING] test_user_edit_face_success...")
     args = parseArgs([
         "-m", "-a", "edit", "-p", "testuser", "-f",
         f"{TEST_IMAGE_DIR}/test_face.jpg"
     ])
     with pytest.raises(SystemExit):
         main(args)
     assert readResponseFile()['CODE'] == 0
Exemple #5
0
 def start(self, strategy, epochs, env, env_size):
     """
     Run learning on Start button press
     """
     if self.strategy.get() and self.epochs.get() and self.environment.get(
     ) and self.env_size_entry.get():
         if self.epochs.get() == 0 or self.env_size_entry.get() == 0:
             print('Mandatory data is missing')
             self.env_size_entry.focus_set()
         else:
             manager.main(strategy, epochs, env, (env_size, env_size))
     else:
         print('Mandatory data is missing')
         self.env_size_entry.focus_set()
Exemple #6
0
 def test_user_profile_fail(self):
     logger.info("[TESTING] test_user_profile_fail...")
     args = parseArgs([
         "-m", "-a", "create", "-f", f"{TEST_IMAGE_DIR}/test_face.jpg",
         "-l", f"{TEST_IMAGE_DIR}/test_lock_1.jpg",
         f"{TEST_IMAGE_DIR}/test_lock_2.jpg",
         f"{TEST_IMAGE_DIR}/test_lock_3.jpg",
         f"{TEST_IMAGE_DIR}/test_lock_4.jpg", "-u",
         f"{TEST_IMAGE_DIR}/test_unlock_1.jpg",
         f"{TEST_IMAGE_DIR}/test_unlock_2.jpg",
         f"{TEST_IMAGE_DIR}/test_unlock_3.jpg",
         f"{TEST_IMAGE_DIR}/test_unlock_4.jpg"
     ])
     with pytest.raises(SystemExit):
         main(args)
     assert readResponseFile()['CODE'] == 13
Exemple #7
0
    def test_user_gesture_rule_broken_fail_on_create(self):
        logger.info(
            "[TESTING] test_user_gesture_rule_broken_fail_on_create...")
        args = parseArgs([
            "-m", "-a", "create", "-p", "testuser", "-f",
            f"{TEST_IMAGE_DIR}/test_face.jpg", "-l",
            f"{TEST_IMAGE_DIR}/test_lock_1.jpg",
            f"{TEST_IMAGE_DIR}/test_lock_1.jpg",
            f"{TEST_IMAGE_DIR}/test_lock_1.jpg",
            f"{TEST_IMAGE_DIR}/test_lock_1.jpg", "-u",
            f"{TEST_IMAGE_DIR}/test_unlock_1.jpg",
            f"{TEST_IMAGE_DIR}/test_unlock_2.jpg",
            f"{TEST_IMAGE_DIR}/test_unlock_3.jpg",
            f"{TEST_IMAGE_DIR}/test_unlock_4.jpg"
        ])
        with pytest.raises(SystemExit):
            main(args)
        assert readResponseFile()['CODE'] == 20

        args = parseArgs([
            "-m", "-a", "create", "-p", "testuser", "-f",
            f"{TEST_IMAGE_DIR}/test_face.jpg", "-l",
            f"{TEST_IMAGE_DIR}/test_lock_1.jpg",
            f"{TEST_IMAGE_DIR}/test_lock_2.jpg",
            f"{TEST_IMAGE_DIR}/test_lock_3.jpg",
            f"{TEST_IMAGE_DIR}/test_lock_4.jpg", "-u",
            f"{TEST_IMAGE_DIR}/test_lock_1.jpg",
            f"{TEST_IMAGE_DIR}/test_lock_2.jpg",
            f"{TEST_IMAGE_DIR}/test_lock_3.jpg",
            f"{TEST_IMAGE_DIR}/test_lock_4.jpg"
        ])
        with pytest.raises(SystemExit):
            main(args)
        assert readResponseFile()['CODE'] == 21

        args = parseArgs([
            "-m", "-a", "create", "-p", "testuser", "-f",
            f"{TEST_IMAGE_DIR}/test_face.jpg", "-l",
            f"{TEST_IMAGE_DIR}/test_lock_1.jpg",
            f"{TEST_IMAGE_DIR}/test_lock_2.jpg",
            f"{TEST_IMAGE_DIR}/test_lock_3.jpg",
            f"{TEST_IMAGE_DIR}/test_lock_4.jpg", "-u",
            f"{TEST_IMAGE_DIR}/test_lock_4.jpg",
            f"{TEST_IMAGE_DIR}/test_lock_3.jpg",
            f"{TEST_IMAGE_DIR}/test_lock_2.jpg",
            f"{TEST_IMAGE_DIR}/test_lock_1.jpg"
        ])
        with pytest.raises(SystemExit):
            main(args)
        assert readResponseFile()['CODE'] == 22
Exemple #8
0
    def test_user_edit_lock_success(self):
        logger.info("[TESTING] test_user_edit_lock_success...")
        # Lock Gesture
        args = parseArgs([
            "-m", "-a", "edit", "-p", "testuser", "-l",
            f"{TEST_IMAGE_DIR}/test_lock_1.jpg",
            f"{TEST_IMAGE_DIR}/test_lock_2.jpg",
            f"{TEST_IMAGE_DIR}/test_lock_3.jpg",
            f"{TEST_IMAGE_DIR}/test_lock_4.jpg"
        ])
        with pytest.raises(SystemExit):
            main(args)
        assert readResponseFile()['CODE'] == 0

        # Unlock Gesture
        args = parseArgs([
            "-m", "-a", "edit", "-p", "testuser", "-u",
            f"{TEST_IMAGE_DIR}/test_unlock_4.jpg",
            f"{TEST_IMAGE_DIR}/test_unlock_2.jpg",
            f"{TEST_IMAGE_DIR}/test_unlock_1.jpg",
            f"{TEST_IMAGE_DIR}/test_unlock_3.jpg"
        ])
        with pytest.raises(SystemExit):
            main(args)
        assert readResponseFile()['CODE'] == 0

        # All Gesture
        args = parseArgs([
            "-m", "-a", "edit", "-p", "testuser", "-l",
            f"{TEST_IMAGE_DIR}/test_lock_1.jpg",
            f"{TEST_IMAGE_DIR}/test_lock_2.jpg",
            f"{TEST_IMAGE_DIR}/test_lock_3.jpg",
            f"{TEST_IMAGE_DIR}/test_lock_4.jpg", "-u",
            f"{TEST_IMAGE_DIR}/test_unlock_3.jpg",
            f"{TEST_IMAGE_DIR}/test_unlock_1.jpg",
            f"{TEST_IMAGE_DIR}/test_unlock_2.jpg",
            f"{TEST_IMAGE_DIR}/test_unlock_4.jpg"
        ])
        with pytest.raises(SystemExit):
            main(args)
        assert readResponseFile()['CODE'] == 0
Exemple #9
0
def login():
    office = check_user_account(username, password)
    if office == "Alpha":
        manager.main()  # If check_user_account() return A --> Manager
    else:
        staff.main(office[0])  # Else --> Staff
Exemple #10
0
                    [self.x[each[0],2],self.x[each[1],2]])
            
        ax.scatter(self.x[:,0], self.x[:,1], self.x[:,2], color = 'g', marker = "o")
        plt.show()
            
    def printMe(self):
        for x in range(0, self.x.shape[0]):
            print self.x[x]       


sh = newShapeFromFile(f)

                     
 
if __name__ == "__main__":
    manager.main()      
        
       
    '''
    def fillShapeFaux(self,drift, kwarg):
        
        
        
        #what if instead of all these different cases, we generate random
        #noise by a random permutation to the set of data
        sigma = 0.1
        if drift == 'a':
            self.standardSet()

            
            
Exemple #11
0
def step_impl(context):
    main()
    pass
Exemple #12
0
 def test_user_delete_user_succeeded(self):
     logger.info("[TESTING] test_user_delete_user_succeeded...")
     args = parseArgs(["-m", "-a", "delete", "-p", "testuser"])
     with pytest.raises(SystemExit):
         main(args)
     assert readResponseFile()['CODE'] == 9
Exemple #13
0
 def test_user_delete_user_not_exist_fail(self):
     logger.info("[TESTING] test_user_delete_user_not_exist_fail...")
     args = parseArgs(["-m", "-a", "delete", "-p", "foobar"])
     with pytest.raises(SystemExit):
         main(args)
     assert readResponseFile()['CODE'] == 9
Exemple #14
0
 def test_user_delete_username_omitted_fail(self):
     logger.info("[TESTING] test_user_delete_username_omitted_fail...")
     args = parseArgs(["-m", "-a", "delete"])
     with pytest.raises(SystemExit):
         main(args)
     assert readResponseFile()['CODE'] == 13
Exemple #15
0
try:
    virtenv = os.path.join(os.environ.get('OPENSHIFT_PYTHON_DIR', '.'),
                           'virtenv')
    python_version = "python" + str(sys.version_info[0]) + "." + str(
        sys.version_info[1])
    os.environ['PYTHON_EGG_CACHE'] = os.path.join(virtenv, 'lib',
                                                  python_version,
                                                  'site-packages')
    virtualenv = os.path.join(virtenv, 'bin', 'activate_this.py')
    if (sys.version_info[0] < 3):
        execfile(virtualenv, dict(__file__=virtualenv))
    else:
        exec(open(virtualenv).read(), dict(__file__=virtualenv))

except IOError:
    pass

#
# IMPORTANT: Put any additional includes below this line.  If placed above this
# line, it's possible required libraries won't be in your searchable path
#

import manager

#
#  main():
#
if __name__ == '__main__':
    manager.main()