Beispiel #1
0
    def test_nothing_to_update(self):
        # arrange
        item = {'admin_name': 'example', 'admin_password': '******'}

        # act
        response = functions.update_current_poll(item, None)
        sys.stdout.buffer.write(str(response).encode('utf-8'))
        print()
        time.sleep(1)

        # assert
        self.assertEqual(response['statusCode'], 400)
Beispiel #2
0
    def test_no_input(self):
        # arrange
        item = {}

        # act
        response = functions.update_current_poll(item, None)
        sys.stdout.buffer.write(str(response).encode('utf-8'))
        print()
        time.sleep(1)

        # assert
        self.assertEqual(response['statusCode'], 403)
Beispiel #3
0
    def test_dt_bigger_than_end(self):
        # arrange
        item = {
            'admin_name': 'example',
            'admin_password': '******',
            'dt': 15600000,
            'end': 10000000
        }

        # act
        response = functions.update_current_poll(item, None)
        sys.stdout.buffer.write(str(response).encode('utf-8'))
        print()
        time.sleep(1)

        # assert
        self.assertEqual(response['statusCode'], 400)
Beispiel #4
0
    def test_good_input(self):
        # arrange
        item = {
            'admin_name': 'example',
            'admin_password': '******',
            'title': 'something new',
            'desc': 'something new',
            'locDesc': 'something new',
            'need': 11,
            'max': 11
        }

        # act
        response = functions.update_current_poll(item, None)
        sys.stdout.buffer.write(str(response).encode('utf-8'))
        print()
        time.sleep(1)

        # assert
        self.assertEqual(response['statusCode'], 200)