Esempio n. 1
0
class SampleTest(EutesterTestCase):
    def __init__(self):
        self.setuptestcase()
        self.setup_parser()
        self.parser.add_argument("--account-number", default=1)
        self.parser.add_argument("--account-prefix", default="test-account-")
        self.parser.add_argument("--group-prefix", default="test-group-")
        self.parser.add_argument("--user-prefix", default="test-user-")
        self.parser.add_argument("--password-prefix", default="mypassword")
        self.parser.add_argument("--user-number", default=1)
        self.get_args()
        # Setup basic eutester object
        self.tester = Eucaops(config_file=self.args.config,
                              password=self.args.password,
                              credpath=self.args.credpath)

    def clean_method(self):
        pass

    def CreateUsers(self):
        """
        This is where the test description goes
        """
        allow_all_policy = """{
          "Statement": [
            {
             "Action": "*",
              "Effect": "Allow",
              "Resource": "*"
            }]
            }"""

        for i in xrange(self.args.account_number):
            account_name = self.args.account_prefix + str(i)
            group_name = self.args.group_prefix + str(i)
            password = self.args.password_prefix + str(i)
            self.tester.create_account(account_name)
            self.tester.create_group(group_name, "/", account_name)
            self.tester.attach_policy_group(group_name, "allow-all",
                                            allow_all_policy, account_name)
            for k in xrange(self.args.user_number):
                user_name = self.args.user_prefix + str(k)
                self.tester.create_user(user_name, "/", account_name)
                self.tester.add_user_to_group(group_name, user_name,
                                              account_name)
                self.tester.create_login_profile(user_name, password,
                                                 account_name)
Esempio n. 2
0
class SampleTest(EutesterTestCase):
    def __init__(self):
        self.setuptestcase()
        self.setup_parser()
        self.parser.add_argument("--account-number",default=1)
        self.parser.add_argument("--account-prefix",default="test-account-")
        self.parser.add_argument("--group-prefix",default="test-group-")
        self.parser.add_argument("--user-prefix",default="test-user-")
        self.parser.add_argument("--user-number",default=2)
        self.get_args()
        # Setup basic eutester object
        self.tester = Eucaops(config_file=self.args.config, password=self.args.password, credpath=self.args.credpath)

    def clean_method(self):
        pass

    def CreateUsers(self):
        """
        This is where the test description goes
        """
        allow_all_policy = """{
          "Statement": [
            {
             "Action": "ec2:*",
              "Effect": "Allow",
              "Resource": "*"
            },
            {
              "Action": "s3:*",
              "Effect": "Allow",
              "Resource": "*"
            }]
            }"""

        for i in xrange(self.args.account_number):
            account_name = self.args.account_prefix + str(i)
            group_name = self.args.group_prefix + str(i)
            self.tester.create_account(account_name)
            self.tester.create_group(group_name, "/",account_name)
            self.tester.attach_policy_group(group_name,"allow-all", allow_all_policy, account_name)
            for k in xrange(self.args.user_number):
                user_name = self.args.user_prefix + str(k)
                self.tester.create_user(user_name, "/", account_name)
                self.tester.add_user_to_group(group_name, user_name, account_name)
Esempio n. 3
0
 parser.add_argument("--group-prefix", default="test-group-")
 args = parser.parse_args()
 tester = Eucaops(credpath=args.credpath)
 allow_all_policy = """{
       "Statement": [
         {
          "Action": "ec2:*",
           "Effect": "Allow",
           "Resource": "*"
         },
      {
           "Action": "s3:*",
           "Effect": "Allow",
           "Resource": "*"
         }
       ]
 }"""
 
 for i in xrange(args.account_number):
     account_name = args.account_prefix + str(i)
     group_name = args.group_prefix + str(i)
     tester.create_account(account_name)
     tester.create_group(group_name, "/",account_name)
     tester.attach_policy_group(group_name,"allow-all", allow_all_policy, account_name)
     for k in xrange(args.user_number):
         user_name = args.user_prefix + str(k)
         tester.create_user(user_name, "/", account_name)
         tester.add_user_to_group(group_name, user_name, account_name)