Пример #1
0
    def test_get_members_for_position(self):
        """
        Tests getting all the users for a specific position
        :return:
        """
        org_utils.assign_member_to_position(self.john.id, self.position.id)
        org_utils.assign_member_to_position(self.owner.id, self.position.id)

        response = json.loads(org_utils.get_members_for_position(self.position.id))
        assert response is not None
        assert 'status' in response
        assert response['status'] == 'success'

        assert 'members' in response
        members = response['members']

        print members
        assert len(members) == 2
        member_one = members[0]
        member_two = members[1]

        assert member_one['first_name'] == 'John'
        assert member_one['last_name'] == 'Doe'
        assert member_one['id'] == 2

        assert member_two['first_name'] == 'Organization'
        assert member_two['last_name'] == 'Owner'
        assert member_two['id'] == 1
Пример #2
0
    def test_get_assigned_positions_for_user(self):
        """
        Tests getting all the users for assigned to a position
        :return:
        """

        org_utils.assign_member_to_position(self.john.id, self.position.id)
        response = json.loads(org_utils.get_assigned_positions_for_user(1, 2))
        assert response is not None
Пример #3
0
 def test_assign_member_to_position(self):
     """
     Tests that a user is assigned to a position
     :return:
     """
     pos = org_utils.get_position(1).id
     user = org_utils.get_user(1).id
     
     org_utils.assign_member_to_position(user, pos)
     assigneduser = position_assignments.select(position_assignments.c.user_id == 1)
     assert assigneduser is not None