forked from fugue/credstash
-
Notifications
You must be signed in to change notification settings - Fork 0
/
key_pair_test.py
22 lines (15 loc) · 877 Bytes
/
key_pair_test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import unittest
import argparse
from credstash import key_value_pair
class TestKeyValuePairExtraction(unittest.TestCase):
def test_key_value_pair_has_two_equals_test(self):
self.assertRaises(argparse.ArgumentTypeError, key_value_pair, "==")
def test_key_value_pair_has_zero_equals(self):
self.assertRaises(argparse.ArgumentTypeError, key_value_pair, "")
def test_key_value_pair_has_one_equals(self):
self.assertRaises(argparse.ArgumentTypeError, key_value_pair, "key1=key2=key3")
def test_key_value_pair_has_both_key_and_value(self):
self.assertRaises(argparse.ArgumentTypeError, key_value_pair, "key=")
self.assertRaises(argparse.ArgumentTypeError, key_value_pair, "=value")
def test_key_value_pair_has_one_equals_with_values(self):
self.assertEqual(key_value_pair("key1=value1"), ["key1", "value1"])