Skip to content
This repository has been archived by the owner on Nov 6, 2020. It is now read-only.

Commit

Permalink
Added possiblity for -test flag to use test skus
Browse files Browse the repository at this point in the history
  • Loading branch information
ianmarmour committed Sep 22, 2020
1 parent 5015ba9 commit 12c9328
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 3 deletions.
26 changes: 26 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,32 @@ chmod +x ./nvidia-clerk-linux
./nvidia-clerk-linux -region=REGION_CODE_HERE
```

## Testing

Testing is currenly only supported for the USA region but it should show you what the automated checkout will look like.

### Windows
| :memo: | All commands should be executed inside of cmd.exe |
|---------------|:------------------------|
```Batchfile
./nvidia-clerk-windows.exe -region=USA -test
```

### Mac OSX
| :memo: | All commands should be executed inside of Terminal.app |
|---------------|:------------------------|
```shell
./nvidia-clerk-darwin -region=USA -test
```

### Linux
| :memo: | All commands should be executed inside of Shell |
|---------------|:------------------------|
```shell
./nvidia-clerk-linux -region=USA -test
```


# Advanced Usage

## SMS Notifications
Expand Down
4 changes: 4 additions & 0 deletions internal/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ type RegionalConfig struct {
Locale string
NvidiaLocale string
Currency string
TestSKU string
}

type TwitterConfig struct {
Expand All @@ -35,6 +36,7 @@ type Config struct {
Locale string
Currency string
SKU string
TestSKU string
TwilioConfig TwilioConfig
TwitterConfig TwitterConfig
DiscordConfig DiscordConfig
Expand Down Expand Up @@ -95,6 +97,7 @@ var regionalConfig = map[string]RegionalConfig{
Locale: "en_us",
NvidiaLocale: "en_us",
Currency: "USD",
TestSKU: "5379432500",
},
"GBR": {
SKU: "5438792800",
Expand Down Expand Up @@ -236,6 +239,7 @@ func GetConfig(region string, smsEnabled bool, discordEnabled bool, twitterEnabl
configuration := Config{}

configuration.SKU = regionConfig.SKU
configuration.TestSKU = regionConfig.TestSKU
configuration.Locale = regionConfig.Locale
configuration.Currency = regionConfig.Currency

Expand Down
4 changes: 1 addition & 3 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ func main() {

// Execute Tests
if *useTest == true {
config.SKU = config.TestSKU
if *useSms == true {
runTest("sms", httpClient, *config)
}
Expand All @@ -81,9 +82,6 @@ func main() {
if testsHaveErrors == true {
fmt.Printf("Testing failed with errors, exiting...\n")
os.Exit(1)
} else {
fmt.Printf("Testing completed succesfully, exiting...\n")
os.Exit(0)
}
}

Expand Down

0 comments on commit 12c9328

Please sign in to comment.